<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Detalle_Reserva_Servicio
 *
 * @author Ivan
 */
class Detalle_Reserva_Servicio extends CI_Model {
    //put your code here
    var $id;
    var $id_reserva;
    var $id_servicio;
    var $id_habitacion;
    var $fecha;
    var $id_usuario;
    var $fecha_usuario;
    var $precio;
    var $observacion;
    
    function __construct() {
        parent ::__construct();
    }
    
    function nuevo()
    {
        $this->id = $_POST['id'];
        $this->id_reserva = $_POST['id_reserva'];
        $this->id_servicio = $_POST['id_servicio'];
        $this->id_habitacion = $_POST['id_habitacion'];
        $this-> fecha = $_POST['fecha'];
        $this->id_usuario = $this->session->userdata('usuario');
        $this->fecha_usuario = date();
        $this->precio = $_POST['precio'];
        $this->observacion = $_POST['observacion'];
        
        $this->db->trans_start();
        $this->db->insert('t_detalle_reserva_servicio', $this);
        $this->db->trans_complete();        
    }
    
    function modificar()
    {       
        $this->id_reserva = $_POST['id_reserva'];
        $this->id_servicio = $_POST['id_servicio'];
        $this->id_habitacion = $_POST['id_habitacion'];
        $this-> fecha = $_POST['fecha'];
        $this->id_usuario = $this->session->userdata('usuario');
        $this->fecha_usuario = date();
        $this->precio = $_POST['precio'];
        $this->observacion = $_POST['observacion'];
        
        $this->db->trans_start();
        $this->db->update('t_detalle_reserva_servicio', array('id'=>$_POST['id']));
        $this->db->trans_complete();
    }
    
    function eliminar()
    {
        $this->db->trans_start();
        $this->db->delete('t_detalle_reserva_servicio',array('id'=> $_POST['id']));
        $this->db->trans_complete();
    }
    
    function getCliente()
    {
        $detalle = $this->db->get_where('t_deatalle_reserva_servicio', array('id'=>$_POST['id']));
        return detalle;                
    }
    
    function listarTodos()
    {
        $detalles = $this->db->get_where('t_deatalle_reserva_servicio', array('id_reserva'=>$_POST['id_reserva']));
        return detalles;   
    }
}
?>